
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

class MainWindow : public QOpenGLWidget, protected QOpenGLFunctions_4_5_Core
{
	Q_OBJECT
public:
	MainWindow(QWidget *parent = nullptr);
	~MainWindow();

    void setPointCloud(const QVector<QVector3D> &points, const QVector<QVector3D> &colors = {});

	public Q_SLOTS:
	void onReceiveDepthFrame(QByteArray depthData);
 
protected:
    void initializeGL() override;
    void resizeGL(int w, int h) override;
    void paintGL() override;
 
private:
    QOpenGLShaderProgram *m_program;
    QOpenGLVertexArrayObject m_vao;
    QOpenGLBuffer m_vbo;
    QMatrix4x4 m_projection;
    
    QVector<QVector3D> m_points;
    QVector<QVector3D> m_colors;
    int m_pointCount;
    bool m_dataUploaded;
};

#endif

